<html>
    <head>
        <title>HTML Document</title>
        <link href="style.css" rel="stylesheet" type="text/css">
    </head>
    <body>

<h1>HTML Document</h1>

<h2>Linking other embedded resources</h2>

<div class="img">
<img src="res://example-html.exe/image.png" title="absolute URL &quot;res://example-html.exe/image.png&quot;">
<img src="image.png" title="relative URL &quot;image.png&quot;">
</div>

<p>This basic HTML document lives as a resource embedded in the program.
The HTML control is able to display such documents. It can be pointed with
the URL <a href="res://example-html.exe/doc.html">res://example-html.exe/doc.html</a>.</p>

<p>The <tt>example-html.exe</tt> determines name of the module (*.exe or *.dll)
where the resource lives and the rest is ID of the HTML resource in it. Note
you can use both numeric and string resource IDs but string identifiers are
recommended.</p>

<p>The document can use other resources as images or cascading style sheets
as the two images on the right demonstrate. One of them is referred
with absolute URL while the second one uses relative URL.</p>

<h2>Linking remote resources</h2>

<p>Of course it can also handle normal HTTP, HTTPS and other protocols:</p>
<ul>
    <li><a href="http://mctrl.org/">http://mctrl.org/</a>
    <li><a href="https://github.com/mity/mctrl/">https://github.com/mity/mctrl/</a>
</ul>

<p>Finally you can have links which are handled programatically by the
application code. When you click on such link, the parent window of HTML
control gets a notification <tt>MC_HN_APPLINK</tt>.</p>
<ul>
    <li><a href="app:SayHello">app:SayHello</a>
</ul>

<h2>URL normalization</h2>

<p>However note that IE sometimes changes the URL as used to navigate and
how it looks in the notification. You can see on the following links
to see the difference. IE can encode some special characters or add slash
after the original URL.

<ul>
    <li><a href="app:boo far">app:boo far</a> - URL with space. IE
    will encode the space into hexadecimal representation.</li>
    <li><a href="app://boo">app://boo</a> - URL with two slashes after
    the protocol and no slash in the &quot;path&quot; after. IE will add slash.</li>
</ul>

<p>It's recommended you avoid such &quot;bad&quot; URL patterns in the
application URLs. Otherwise your application might need more complex
URL matching in code handling the <tt>MC_HN_APPLINK</tt> notifications then
simple string comparisons.</p>

<h2>Dynamic contents</h2>

<p>Application is able to modify contents of the HTML page with the message
<tt>MC_HM_SETTAGCONTENTS</tt>.</p>

<div id="dynamic">Contents of this tag will be replaced by the example code in
runtime.</div>

<h2>JavaScript function called from C code</h2>

<p>This HTML document provides a simple example JavaScript function which
concatenates three strings. By clicking the following link, you ask the
application to call it via the message <tt>MC_HM_CALLSCRIPTFUNC</tt>.</p>

<ul>
    <li><a href="app:call_js_func">Call JS function</a></li>
</ul>

<!-- An example of JavaScript function which is called from the application.
     Triggered by clicking on the link above (through the 'app:' protocol).
-->
<script type="text/javascript">
function concat_three(arg1, arg2, arg3)
{
    alert("Hey, this popup was triggered by JS code!\n" +
          "\nArg1: '" + arg1 + "'\nArg2: '" + arg2 + "'\nArg3: '" + arg3 + "'");
    return arg1 + arg2 + arg3;
}
</script>

    </body>
</html>
